<%--
  Created by IntelliJ IDEA.
  User: 许正雄
  Date: 2021/12/7
  Time: 11:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台管理</title>
    <link type="text/css" rel="stylesheet" href="/static/css/style.css" />
    <script type="text/javascript" src="/static/scripts/function-manage.js"></script>
    <script type="text/javascript" src="/static/jquery3.6.0.js"></script>
</head>
<body>
<%@include file="/manage/head.jsp"%>
<div id="main" class="wrap">
    <%@include file="manage/left.jsp"%>
    <div class="main">
        <h2>新增展示列表</h2>
        <div class="manage">
            <form id="fm" method="post" action="/addShowAll" enctype="multipart/form-data">
                <table class="form">
                    <tr>
                        <td class="field">展示名称：</td>
                        <td><input id="showName" type="text" class="text" name="showName" value="" /></td>
                    </tr>
                    <tr>
                        <td class="field">展示类型：</td>
                        <td>
                            <label for="xl"></label><select name="strId" id="xl">
                                <option value="">请选择</option>
<%--                                <c:forEach items="${showTypes}" var="types">--%>
<%--                                    <option value="${types.id}">${types.showTypeName}</option>--%>
<%--                                </c:forEach>--%>
                            </select>
                        </td>
                    </tr>
<%--                    <tr>--%>
<%--                        <td class="field">是否商品：</td>--%>
<%--                        <td>--%>
<%--                            <select name="goodsFlag">--%>
<%--                                <option value="1" >是</option>--%>
<%--                                <option value="0" selected>否</option>--%>
<%--                            </select>--%>
<%--                        </td>--%>
<%--                    </tr>--%>
<%--                    <tr>--%>
<%--                        <td class="field">商品价格：</td>--%>
<%--                        <td><input id="goodsPrice" type="text" class="text" name="goodsPrice" value="" /></td>--%>
<%--                    </tr>--%>
                    <tr>
                        <td class="field">图片：</td>
                        <td><input type="file" id="pic" multiple="multiple" class="text" name="photo" /></td>
                    </tr>
                    <tr>
                        <td class="field">描述：</td>
                        <td><textarea id="remark" type="text" class="text" name="remark" value=""></textarea></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><label class="ui-blue"><input id="submit" type="submit" name="submit" value="添加" /></label></td>
<%--                        <td><label class="ui-blue"><button id="tj" type="button">添加</button></label></td>--%>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="clear"></div>
</div>


<div class=""></div>
<div id="footer">
</div>
</body>
<script type="text/javascript">
    $(function () {
        $("#showName").blur(function () {
            $.ajax({
                url:"../selectShowTypeAll",
                type:"post",
                data: "",
                success:function (ret) {
                    console.log(ret)
                    let str="<option value=''>请选择</option>";
                    for(let i=0;i<ret.length;i++){
                        str+="<option value='"+ret[i].strId+"'>"+ret[i].showTypeName+"</option>";
                    }
                    $("#xl").html(str);
                }
            })
        })
    })
    // $(function () {
    //     $("#tj").click(function () {
    //         if ($("#showName").val() == null || $("#showName").val() === '') {
    //             alert("展示名称不能为空")
    //             return false
    //         // }else if ($("#xl").val() == ""){
    //         //     alert("请选择展示类型")
    //         }else {
    //                 $.ajax({
    //                     url:"../addShowAll",
    //                     type:"post",
    //                     // enctype:"multipart/form-data",
    //                     data:$("#fm").serialize(),
    //                     success:function (ret) {
    //                         if (ret*1===1){
    //                             alert("添加成功！")
    //                             window.location.href="findShowAllPage";
    //                         }
    //                     }
    //                 })
    //             }
    //     })
    //
    // })
</script>
</html>

